package com.tau.egonetwork.facebook;

import com.tau.egonetwork.net.IRequest;

public class FacebookAuthRequest {

	private final static String APP_ID = "415362698592842";
	private final static String APP_SECRET = "df6a87ef619a22a4e426f32fc8d5d662";
		
	public static IRequest generateAuthRequest(){
		return new IRequest() {
			
			@Override
			public String generateRequestURL() {
				
				StringBuilder s = new StringBuilder();
				
				s.append("https://graph.facebook.com/oauth/authorize");
				s.append("?client_id=");
				s.append(APP_ID);
				s.append("&redirect_uri=http://engineering.tau.ac.il/");
				s.append("&scope=");
				s.append("user_about_me,");
				s.append("user_groups,");
				s.append("user_friends,");
				s.append("user_location,");
				s.append("user_relationship_details,");
				s.append("user_activities,");
				s.append("user_relationships,");
				s.append("user_work_history,");
				s.append("friends_about_me,");
				s.append("friends_location,");
				s.append("friends_relationship_details,");
				s.append("friends_relationships,");
				s.append("friends_work_history,");
				s.append("friends_activities,");
				s.append("read_friendlists");
				s.append("&display=popup");

				return s.toString();
			}
		};
	}
	
	public static IRequest generateAuthCodeRequest(final String code) {
		return new IRequest() {
			
			@Override
			public String generateRequestURL() {
				
				StringBuilder s = new StringBuilder();
				
				s.append("https://graph.facebook.com/oauth/access_token?client_id=");
				s.append(APP_ID);
				s.append("&redirect_uri=http://engineering.tau.ac.il/&client_secret=");
				s.append(APP_SECRET);
				s.append("&code=");
				s.append(code);
				
				return s.toString();
			}

		};
	}
}
